<?php
namespace App;

use Illuminate\Database\Eloquent\Model;

class task extends Model
{    // 允许写入的字段
    protected $fillable = [
        'title','project_id','status'
    ];
    public function project(){
        // 取得task模型实例，$task->project(),知道任务查询属于哪个项目
        return $this->belongsTo('App\project');
    }

    public function getProjectssAttribute(){
        return $this->project->id;
    }
}
